<?php

namespace app\modules\admin;
use \Yii;
/**
 * admin module definition class
 */
class AdminMoudule extends \yii\base\Module
{
    /**
     * @inheritdoc
     */
    public $controllerNamespace = 'app\modules\admin\controllers';
    public $layout = '../layouts/main';

    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();

        // custom initialization code goes here
        Yii::$app->errorHandler->errorAction = 'admin/default/error';
        Yii::$app->user->loginUrl = ['/admin/default/login'];
        Yii::$app->homeUrl = ['/admin/default/index'];
//        if(Yii::$app->user->isGuest && Yii::$app->request->pathInfo != 'admin/default/login'){
//            exit('无权访问');
//        }
        $this->modules = [
            'auth' => [
                'class' => 'mdm\admin\Module',
                'layout' => 'top-menu',
                'mainLayout' => '@app/modules/admin/views/layouts/main.php',
            ],
        ];
    }
}
